const prompt = require('inquirer').createPromptModule()
const moment = require('moment')

function launch(){
	return prompt([
		{
			type: 'confirm',
			name: 'test',
			message: '这是测试的',
			default: true
		},
		{
			type: 'input',
			name: 'componentName',
			message: '请输入要创建的组件名称(kebab-case):',
			validate: function(str){
				return /^[a-z][a-z|-]*[a-z]$/.test(str)
			}
		},
		{
			type: 'input',
			name: 'componentCnName',
			message: '请输入要创建的组件中文名称(中文):'
		},
		{
			type: 'list',
			choices: [
				'basic', 'feedback', 'form','business', 'gestures'
			],
			name: 'componentType',
			message: '组件类型'
		},
		{
			type: 'input',
			name: 'author',
			message: '作者',
			default: function(){
				return 'Liuls@belink.com'
			}
		},
		{
			type: 'input',
			name: 'time',
			message: 'time',
			default: moment().format('YYYY年MM月DD日')
		}
	]).then(answers => {
		console.log(answers)
	})
}

launch()